* @return string */ $filter_rating_html = function( $html, $rating, $count ) use ( $post_id, $product_rating, $product_reviews_count, $is_descendent_of_single_product_block, $is_descendent_of_single_product_template ) { $product_permalink = get_permalink( $post_id ); $reviews_count = $count; $average_rating = $rating; if ( $product_rating ) { $average_rating = $product_rating; } if ( $product_reviews_count ) { $reviews_count = $product_reviews_count; } if ( 0 < $average_rating || false === $product_permalink ) { /* translators: %s: rating */ $label = sprintf( __( 'Rated %s out of 5', 'woocommerce' ), $average_rating ); $customer_reviews_count = sprintf( /* translators: %s is referring to the total of reviews for a product */ _n( '(%s customer review)', '(%s customer reviews)', $reviews_count, 'woocommerce' ), esc_html( $reviews_count ) ); if ( $is_descendent_of_single_product_block ) { $customer_reviews_count = '' . $customer_reviews_count . ''; } elseif ( $is_descendent_of_single_product_template ) { $customer_reviews_count = '' . $customer_reviews_count . ''; } $reviews_count_html = sprintf( '%1$s', $customer_reviews_count ); $html = sprintf( '
%3$s
', esc_attr( $label ), wc_get_star_rating_html( $average_rating, $reviews_count ), $is_descendent_of_single_product_block || $is_descendent_of_single_product_template ? $reviews_count_html : '' ); } else { $html = ''; } return $html; }; add_filter( 'woocommerce_product_get_rating_html', $filter_rating_html, 10, 3 ); $rating_html = wc_get_rating_html( $product->get_average_rating() ); remove_filter( 'woocommerce_product_get_rating_html', $filter_rating_html, 10 ); return sprintf( '
%4$s
', esc_attr( $text_align_styles_and_classes['class'] ?? '' ), esc_attr( $styles_and_classes['classes'] ), esc_attr( $styles_and_classes['styles'] ?? '' ), $rating_html ); } return ''; } }
Fatal error: Uncaught Error: Class "Automattic\WooCommerce\Blocks\BlockTypes\ProductRating" not found in /htdocs/iptvmaroc.com/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php:153 Stack trace: #0 /htdocs/iptvmaroc.com/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Blocks\BlockTypesController->register_blocks('') #1 /htdocs/iptvmaroc.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #2 /htdocs/iptvmaroc.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #3 /htdocs/iptvmaroc.com/wp-settings.php(700): do_action('init') #4 /htdocs/iptvmaroc.com/wp-config.php(96): require_once('/htdocs/iptvmar...') #5 /htdocs/iptvmaroc.com/wp-load.php(50): require_once('/htdocs/iptvmar...') #6 /htdocs/iptvmaroc.com/wp-blog-header.php(13): require_once('/htdocs/iptvmar...') #7 /htdocs/iptvmaroc.com/index.php(17): require('/htdocs/iptvmar...') #8 {main} thrown in /htdocs/iptvmaroc.com/wp-content/plugins/woocommerce/src/Blocks/BlockTypesController.php on line 153